<?php
class ClassTeacher extends Zend_Db_Table
{
	protected $_name ="class_teacher";
	protected $_primary = 'id';


         // 查询所有teacher
    public function getAllclassTeachers(){
          $where = "1=1";
          $select = $this->select();
          $select->where($where);
          if($page!=""){
          $select->limitPage($page,$perpage);
          }
          $select->order('id desc');
          return $this->fetchAll($select)->toArray();
    }

   public function updateinarray($array,$id){

            $db = $this->getAdapter();
            $where=$db->quoteInto('id = ?', $id);
            $this->update($array, $where);
            return true;
   }

 //根据id 查询class_teacher
    public function getclass_teacherByid($id){
          $select = $this->select();
          $select->where("id=".$id);
          return $this->fetchAll($select)->toArray();
    }
 //根据class_id 查询class_teacher
    public function getclass_teacherBytype($class_id,$category){
        
          $select = $this->select();
          $select->where("class_id=".$class_id." and category=".$category);
          return $this->fetchAll($select)->toArray();
          
    }
     //根据class_id 查询class_teacher
    public function getclass_teacherByteacher_id($class_id,$teacher_id){

          $select = $this->select();
          $select->where("class_id=".$class_id." and teacher_id=".$teacher_id);
        //  return $select->__toString();
          return $this->fetchAll($select)->toArray();

    }
 //根据class_id 查询class_teacher
    public function getclass_teacherByclassid($class_id){

          $select = $this->select();
          $select->where("class_id=".$class_id);
          return $this->fetchAll($select)->toArray();

    }

 //更新class_teacher
    public function updateclass_teacherByid($array,$id){
		$db = $this->getAdapter();
		$where=$db->quoteInto('id = ?', $id);
		$this->update($array, $where);
                
                return true;
	}
//删除class_teacher
     public function delclass_teacherByid($id){
          $where = 'id = '. $id;
         $this->delete($where);
         return true;
    }

    
}

